/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.its.dds2.ServicesSystem.Modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Carlos Asis
 */
@Entity
@Table(name = "typeclass")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Typeclass.findAll", query = "SELECT t FROM Typeclass t"),
    @NamedQuery(name = "Typeclass.findById", query = "SELECT t FROM Typeclass t WHERE t.id = :id"),
    @NamedQuery(name = "Typeclass.findByType", query = "SELECT t FROM Typeclass t WHERE t.type = :type"),
    @NamedQuery(name = "Typeclass.findByMount", query = "SELECT t FROM Typeclass t WHERE t.mount = :mount")})
public class Typeclass implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "type")
    private Character type;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "mount")
    private BigDecimal mount;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idclass")
    private List<Usersystem> usersystemList;

    public Typeclass() {
    }

    public Typeclass(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Character getType() {
        return type;
    }

    public void setType(Character type) {
        this.type = type;
    }

    public BigDecimal getMount() {
        return mount;
    }

    public void setMount(BigDecimal mount) {
        this.mount = mount;
    }

    @XmlTransient
    public List<Usersystem> getUsersystemList() {
        return usersystemList;
    }

    public void setUsersystemList(List<Usersystem> usersystemList) {
        this.usersystemList = usersystemList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Typeclass)) {
            return false;
        }
        Typeclass other = (Typeclass) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return id+"";
    }
    
}
